Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Banner | Use Cloudflare worker on own domain for GeoIP #4798

Merged
merged 5 commits into from
Oct 4, 2021
Merged

Conversation

MichaIng
Copy link
Owner

@MichaIng MichaIng commented Oct 4, 2021

Status: Ready

Commit list/description:

  • DietPi-Banner | Use Cloudflare worker on own domain to provide GeoIP information

This should once and for all solve those nasty blocklist issues as long as we take care that no unintended 3rd parties start to use it (in which case we may implement a user agent or headers based filter).

One change compared to the previous solution is that the country is shown with the two letter country code, e.g. DE instead of Germany. There is no native Cloudflare workers API to get the long name. It is trivial to add additional fields to the response, e.g. we can achieve this via GET parameters in future DietPi versions, keeping the default <IP> [<region if available] <country> if no query string is passed, to keep backwards compatibility.

Another thing: I'm not sure how the public APIs handle it, but in our case, AFAIK a proxy will lead to the proxy servers IP and location being shown, as we do not respect the proxy headers, just the Cloudflare request headers. But could be tested, probably Cloudflare itself overrides its client IP header with the proxy header, when present. I however think this is actually fine so that one can check whether a proxy is used as expected, similar to how the VPN server IP is shown when a VPN is used (in which case there is no original client header available, of course).

+ DietPi-Banner | Use Cloudflare worker on own domain to provide GeoIP information
@MichaIng MichaIng added this to the v7.7 milestone Oct 4, 2021
@MichaIng MichaIng requested a review from Joulinar October 4, 2021 15:28
@MichaIng MichaIng linked an issue Oct 4, 2021 that may be closed by this pull request
+ DietPi-Banner | Inline errors when obtaining WAN IP
+ DietPi-VPN | Inline errors when obtaining WAN IP
@MichaIng MichaIng linked an issue Oct 4, 2021 that may be closed by this pull request
@MichaIng
Copy link
Owner Author

MichaIng commented Oct 4, 2021

Removed adding the old one to Pi-hole whitelist: 04939bc

+ DietPi-Patches | Do not add the 3rd party GEO IP API to the Pi-hole whitelist anymore, as we use our own now
+ CHANGELOG | DietPi-Globals: G_GET_WAN_IP: We use our own GEO IP service now to show the systems WAN IP and location in the DietPi banner and DietPi-VPN. When Pi-hole was used, with a previous update, "freegeoip.app" was added to Pi-hole's whitlist, which is now not required anymore. You may hence remove that entry from the whitelist.
@MichaIng MichaIng merged commit aac254f into dev Oct 4, 2021
@MichaIng MichaIng deleted the geoip branch October 4, 2021 18:49
@Joulinar
Copy link
Collaborator

Joulinar commented Oct 4, 2021

should we remove PiHole whitelisting on next update?

@MichaIng
Copy link
Owner Author

MichaIng commented Oct 4, 2021

I added the hint to the changelog, but I think it is okay to not remove it automatically as it may be used manually. Probably a yes-no question whether to remove or keep it would be okay, if we can check whether it is on the list at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WAN IP no longer displaying upon boot - Raspberry Pi WAN IP in dietpi-banner has a tendency to not resolve
2 participants